#ifndef _THREAD_MANAGER_H_
# define _THREAD_MANAGER_H_

# include <queue>
# include <SDL/SDL_thread.h>

# define THREAD_NUMBER		4

struct MyThread
{
	SDL_Thread*		Thread;
	bool			IsUsed;
	int				(*Func)(void*);
	void*			Datas;
	SDL_cond*		Cond;
	bool			Finished;

	MyThread();
	~MyThread();
};

class ThreadManager
{
private:
	static bool m_quit;
	MyThread m_threads[THREAD_NUMBER];

public:
	ThreadManager();
	~ThreadManager();

public:
	static bool GetQuit();
	static void Quit();
	bool useThread(int (*_func)(void*), void* _datas);
	void reinitThreads();
};

int threadWaiting(void*);
int checkQueue(void*);

#endif // _THREAD_MANAGER_H_
